﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Web;

namespace EmptoolWebApp.Entities
{
    [Serializable]
    [DataContract]
    public class TaskEntity : BaseTableEntity
    {
        public const string TABLE_NAME = "Task";

        #region constructor(s)
        public TaskEntity() : base()
        {

        }

        public TaskEntity(string userId, string title, string description, bool isComplete) : base()
        {
            if (string.IsNullOrWhiteSpace(title))
            {
                throw new ArgumentNullException("title");
            }
            if (string.IsNullOrWhiteSpace(description))
            {
                throw new ArgumentNullException("description");
            }

            this.PartitionKey = Helpers.CryptographyHelper.UserHash(userId);
            this.RowKey = Guid.NewGuid().ToString();

            this.Title = title;
            this.Description = description;
            this.IsComplete = isComplete;
        }
        #endregion constructor(s)

        [DataMember]
        public string Title { get; set; }

        [DataMember]
        public string Description { get; set; }

        [DataMember]
        public bool IsComplete { get; set; }
    }
}